home *** CD-ROM | disk | FTP | other *** search
- /*[a-,body+,h-,o=100,r+,rec+,t=4,u+,#+,j=20/57/1$,n-]*/
- /* UViewCoords.p */
- /* Copyright © 1987-1990 by Apple Computer, Inc. All rights reserved. */
- #ifndef __UVIEWCOORDS__
- #define __UViewCoords__ 0
- #endif
- #if ! __UViewCoords__
- #define __UViewCoords__ 1
-
- /* • Auto-Include the requirements for this unit's interface. */
- #ifndef __UMacAppUtilities__
- #include "UMacAppUtilities.h"
- #endif
-
- const short kMaxCoord = 30000;
- /* largest possible QuickDraw view coordinate
- (QuickDraw maximum minus slop for size of
- screen) */
-
- /* Calculations with VPoints */
-
- extern pascal void PtToVPt(Point thePt, VPoint *theVPt);
- /* Convert a QD Point to a VPoint. */
-
- extern pascal Point VPtToPt(VPoint *theVPt);
- /* Convert a VPoint to a QD Point. */
-
- extern pascal void AddVPt(VPoint *srcVPt, VPoint *dstVPt);
- /* Adds the coordinates of 'srcVPt' to the coordinates of 'dstVPt' returning result in
- 'dstVPt'. */
-
- extern pascal void SubVPt(VPoint *srcVPt, VPoint *dstVPt);
- /* Subtracts the coordinates of 'srcVPt' from the coordinates of 'dstVPt' returning resu
- lt in
- 'dstVPt'. */
-
- extern pascal void SetVPt(VPoint *vPt, VCoordinate h, VCoordinate v);
- /* Assigns the two given coordinates to 'vPt'. */
-
- extern pascal Boolean EqualVPt(VPoint *pt1, VPoint *pt2);
- /* Compares the two VPoints returning TRUE if they are equal and FALSE if not. */
-
- /* Calculations with VRects */
-
- extern pascal void RectToVRect(Rect *theRect, VRect *theVRect);
- /* Converts a QD Rect to a VRect. */
-
- extern pascal void VRectToRect(VRect *theVRect, Rect *theRect);
- /* Converts a VRect to a QD Rect. */
-
- extern pascal void SetVRect(VRect *r, VCoordinate left, VCoordinate top, VCoordinate right,
- VCoordinate bottom);
- /* Sets the boundary coordinates of the VRect 'r' . */
-
- extern pascal void OffsetVRect(VRect *r, VCoordinate dh, VCoordinate dv);
- /* Moves the given VRect by adding 'dh' to each horizontal and 'dv' to each vertical
- coordinate. Postive values cause the movement to be to the right and down, while negative
- are the opposite. */
-
- extern pascal void InsetVRect(VRect *r, VCoordinate dh, VCoordinate dv);
- /* Shrinks or expands the given VRect.The left and right sides are moved in by 'dh', the top
- and bottom by 'dv'. If the values are negative the movement is outward. */
-
- extern pascal Boolean PtInVRect(VPoint *pt, VRect *r);
- /* Determines whether the pixel below and to the right of the given coordinate is enclos
- ed by
- the specified VRect, returns TRUE if so or FALSE if not. */
-
- extern pascal Boolean SectVRect(VRect *src1, VRect *src2, VRect *dstRect);
- /* Calculates the VRect that is the intersection of the two given VRects, returns TRUE i
- f they
- intersect and FALSE if not. */
-
- extern pascal Boolean EmptyVRect(VRect *r);
- /* Returns TRUE if the given VRect is an empty VRect, FALSE if not. */
-
- extern pascal Boolean EqualVRect(VRect *rectA, VRect *rectB);
- /* Compares the two given VRects and returns TRUE if they are equal FALSE if not. */
-
- extern pascal VCoordinate LengthVRect(VRect *r, VHSelect vhs);
- /* Returns the length of the given VRect in the direction determined by 'vhs'. */
-
- extern pascal void PinVRect(VRect *r, VPoint *pt);
- /* Pins the given VPoint to the given VRect. */
-
- extern pascal void UnionVRect(VRect *src1, VRect *src2, VRect *dstRect);
- /* Calculates the smallest VRect that encloses both the given VRects, returns the result in
- 'dstRect'. */
-
- extern pascal void Pt2VRect(VPoint *topLeft, VPoint *botRight, VRect *dstRect);
- /* Returns the smallest VRect that encloses to given VPoints. */
- #endif
-
-